# Contributor: Curt Tilmes <Curt.Tilmes@nasa.gov>
# Maintainer: Curt Tilmes <Curt.Tilmes@nasa.gov>
pkgname=moarvm
pkgver=2024.09
pkgrel=0
pkgdesc="VM with adaptive optimization and JIT compilation, built for Rakudo"
url="https://moarvm.org/"
arch="all"
license="Artistic-2.0"
depends_dev="$pkgname=$pkgver-r$pkgrel perl zstd-dev libffi-dev libuv-dev"
makedepends="$depends_dev"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/MoarVM/MoarVM/releases/download/$pkgver/MoarVM-$pkgver.tar.gz"
builddir="$srcdir/MoarVM-$pkgver"
options="!check" # No tests

build() {
	unset CPPFLAGS CFLAGS
	perl Configure.pl --prefix=/usr --has-libffi \
		--has-libuv --no-mimalloc --debug
	make
}

package() {
	make PKGCONFIGDIR=/usr/lib/pkgconfig \
		DESTDIR="$pkgdir" install

	install -Dvm644 Artistic2.txt CREDITS LICENSE \
		MANIFEST README.markdown VERSION \
		-t "$pkgdir"/usr/share/doc/"$pkgname"
	cp -vr docs "$pkgdir"/usr/share/doc/"$pkgname"/
}

dev() {
	default_dev
	amove usr/share/nqp/lib
}

sha512sums="
ff3b3db60a726e5dfdca617dc5ea4393b84e2317a6ca8079a7cebb7737a5cf614850097cc73b5d7d3edf8c9f7ff0ffb375ec73b67d591d31f90aca1d2bb5f079  moarvm-2024.09.tar.gz
"
